interface ShareConfig {
  title?: string;
  path?: string;
  friendImageUrl?: string;
  timelineImageUrl?: string;
}

export function useShare(config: ShareConfig = {}) {
  const defaultConfig = {
    title: "--",
    path: "--"
  };

  // 合并默认配置和自定义配置
  const finalConfig = { ...defaultConfig, ...config };

  return {
    onShareAppMessage() {
      console.log(">>>>>>onShareAppMessage");
      console.log(finalConfig.path, "finalConfig.path");

      console.log(finalConfig.title, "finalConfig.title");

      return {
        title: finalConfig.title,
        path: finalConfig.path,
        imageUrl: finalConfig.friendImageUrl
      };
    },

    onShareTimeline() {
      console.log(">>>>>>onShareTimeline");

      return {
        title: defaultConfig.title,
        imageUrl: finalConfig.timelineImageUrl
      };
    }
  };
}
